<template>
  <div  >

      <div class="top">
        <div class="card-avatar" :style="{backgroundColor:color}"></div>
        <div>{{names}}</div>
      </div>
      <div class="bottom">
        <van-cell title="职称" :value=position></van-cell>
        <van-cell title="联系方式" :value=phone></van-cell>
      </div>
    </div>
</template>

<script>
import dd from 'dingtalk-jsapi';
export default {
  name: "UserView",
  data:function () {
    return{
      names:'',
      position:'',
      phone:'',
      color:'#39a9ed'
    }
  },
  created() {
    dd.getAuthCode({
      corpId: 'ding0a40cdce33c8deb624f2f5cc6abecb85',
      success: (res) => {

        const {code}=res;

        this.$http.get(`/system/dingding/v2/user/${code}`)
          .then((res)=>{

            const{name}=res.data.result;
            const {title}=res.data.result;
            const{mobile}=res.data.result;

            this.names=name;

            this.position=title;
            this.phone=mobile;
          })

      },
      fail: () => {uni.request({
        url:'http://localhost:8088/system/dingding/login',
        method:'GET'
      })},
      complete: () => {},
    });
  },
}

</script>

<style scoped>
.top{

  display: flex;

 }.card-avatar {
    width: 60px;
    height: 60px;


  }


</style>
